package com.dfbz.demo04_匿名内部类;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo03_匿名内部类小练习_01 {
    public static void main(String[] args) {


        Task t1=new DownloadTask();
        t1.run();
        System.out.println("-------");

        Task t2=new UploadTask();
        t2.run();

        System.out.println("--------------------");


        /*

            class Xxx implements Task{
                public void run(){
                    System.out.println("刷剧任务....");
                }
            }

                Task t3= new Xxx();
                t3.run();
         */
        Task t3= new Task(){
            public void run(){
                System.out.println("刷剧任务....");
            }
        };

        t3.run();


    }
}

interface Task{
    void run();
}

class DownloadTask implements Task{
    @Override
    public void run() {
        System.out.println("下载任务");
    }
}

class UploadTask implements Task{

    @Override
    public void run() {
        System.out.println("上传任务");
    }
}